package io.hugetower.modules.sys.controller;

import io.hugetower.common.utils.PageUtils;
import io.hugetower.common.utils.R;
import io.hugetower.modules.sys.entity.SysLogLoginEntity;
import io.hugetower.modules.sys.service.SysLogLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 登录日志
 *
 * @author liuyan
 * @email liuyan@hugetower.cn
 * @date 2020-04-26 10:12:31
 */
@RestController
@RequestMapping("sys/sysloglogin")
public class SysLogLoginController {
    @Autowired
    private SysLogLoginService sysLogLoginService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("sys:sysloglogin:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysLogLoginService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("sys:sysloglogin:info")
    public R info(@PathVariable("id") Long id){
		SysLogLoginEntity sysLogLogin = sysLogLoginService.getById(id);

        return R.ok().put("sysLogLogin", sysLogLogin);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//    @RequiresPermissions("sys:sysloglogin:save")
    public R save(@RequestBody SysLogLoginEntity sysLogLogin){
		sysLogLoginService.save(sysLogLogin);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("sys:sysloglogin:update")
    public R update(@RequestBody SysLogLoginEntity sysLogLogin){
		sysLogLoginService.updateById(sysLogLogin);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("sys:sysloglogin:delete")
    public R delete(@RequestBody Long[] ids){
		sysLogLoginService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
